package org.hentai.controller;

import com.aizuda.zlm4j.callback.IMKSourceFindCallBack;
import com.aizuda.zlm4j.structure.MK_MEDIA_SOURCE;
import com.sun.jna.Pointer;
import org.hentai.context.MediaServerContext;
import org.hentai.entity.MediaInfoResult;
import org.hentai.service.LiveStreamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/living")
public class LiveController {

    @Autowired
    LiveStreamService service;

    @GetMapping("/list")
    public List<MediaInfoResult> livingStreams(@RequestParam(value = "schema", required = false) String schema,
                                               @RequestParam(value = "app", required = false) String app,
                                               @RequestParam(value = "stream", required = false) String stream) {
        return service.getMediaList(schema, app, stream);
    }

    @GetMapping("/close")
    public Integer closeStream(@RequestParam("schema") String schema, @RequestParam("app") String app, @RequestParam("stream") String stream) {
        return service.closeStreams(schema, app, stream);
    }



}
